import React from 'react'
import PropTypes from 'proptypes'
import style from './index.css'

const Dialog = props => {
    const { show, close, children } = props;

    if (!show)
        return null;

    return (
        <div className={style.dialog}>
            <div className={style.mask} onClick={close}></div>
            <div className={style.content}>
                { children }
            </div>
        </div>
    )
}

Dialog.propTypes = {
    show: PropTypes.bool,
    close: PropTypes.func
}

export default Dialog;
